<template>
  <div>
    <el-row :gutter="40" class="panel-group">
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'balance', query: { coinid: '3' } })">
          <div class="card-panel-icon-wrapper icon-shopping">
            <svg-icon icon-class="xse" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">AL1总余额</div>
            <count-to :start-val="0" :end-val="Number(total['AL1总余额'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'balance', query: { coinid: '4' } })">
          <div class="card-panel-icon-wrapper icon-shopping">
            <svg-icon icon-class="xse" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">AL2总余额</div>
            <count-to :start-val="0" :end-val="Number(total['AL2总余额'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'balance', query: { coinid: '2' } })">
          <div class="card-panel-icon-wrapper icon-shopping">
            <svg-icon icon-class="xse" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">ALEO总余额</div>
            <count-to :start-val="0" :end-val="Number(total['ALEO总余额'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'balance', query: { coinid: '1' } })">
          <div class="card-panel-icon-wrapper icon-shopping">
            <svg-icon icon-class="xse" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">USDT总余额</div>
            <count-to :start-val="0" :end-val="Number(total['USDT总余额'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'RecordRecharge', query: { time: 'today',coinid: '1' } })">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="xse" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">USDT今日充值</div>
            <count-to :start-val="0" :end-val="Number(total['USDT今日充值'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'CountRecharge', query: { coinid: '1' } })">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="xfjf" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">USDT累计充值</div>
            <count-to :start-val="0" :end-val="Number(total['USDT累计充值'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'BalanceRecord', query: { type: 'day' } })">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="lir" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">今日充值[系统](U)</div>
            <count-to :start-val="0" :end-val="Number(total['今日充值[系统]'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'BalanceRecord', query: { type: '2' } })">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="neij" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">累计充值[系统](U)</div>
            <count-to :start-val="0" :end-val="Number(total['累计充值[系统]'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'RecordWithdrawal', query: { time: 'day' } })">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">今日提现</div>
            <count-to :start-val="0" :end-val="Number(total['今日提现'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'RecordWithdrawal', query: { type: '0' } })">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="shouyi" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">待审核提现</div>
            <count-to :start-val="0" :end-val="Number(total['待审核提现'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'CountWithdrawal', query: { time: 'day' } })">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="chart" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">累计提现</div>
            <count-to :start-val="0" :end-val="Number(total['累计提现'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'CountWithdrawal', query: { time: 'day' } })">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="chart" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">累计提现手续费</div>
            <count-to :start-val="0" :end-val="Number(total['累计提现手续费'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'CountWithdrawal', query: { time: 'day' } })">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">今日提现手续费</div>
            <count-to :start-val="0" :end-val="Number(total['今日提现手续费'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '15', coinid: '3' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">團體收益AL1总收益</div>
            <count-to :start-val="0" :end-val="Number(total['團體收益AL1总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '15', coinid: '4' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">團體收益AL2总收益</div>
            <count-to :start-val="0" :end-val="Number(total['團體收益AL2总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '16', coinid: '3' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">平級獎AL1总收益</div>
            <count-to :start-val="0" :end-val="Number(total['平級獎AL1总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '16', coinid: '4' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">平級獎AL2总收益</div>
            <count-to :start-val="0" :end-val="Number(total['平級獎AL2总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '14', coinid: '3' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">間享收益AL1总收益</div>
            <count-to :start-val="0" :end-val="Number(total['間享收益AL1总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '14', coinid: '4' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">間享收益AL2总收益</div>
            <count-to :start-val="0" :end-val="Number(total['間享收益AL2总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '13', coinid: '3' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">靜享收益AL1总收益</div>
            <count-to :start-val="0" :end-val="Number(total['靜享收益AL1总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '13', coinid: '4' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">靜享收益AL2总收益</div>
            <count-to :start-val="0" :end-val="Number(total['靜享收益AL2总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '12', coinid: '3' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">靜值收益AL1总收益</div>
            <count-to :start-val="0" :end-val="Number(total['靜值收益AL1总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'TotalIncome', query: { tradetype: '12', coinid: '4' } })">
          <div class="card-panel-icon-wrapper icon-zi">
            <svg-icon icon-class="xjye" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">靜值收益AL2总收益</div>
            <count-to :start-val="0" :end-val="Number(total['靜值收益AL2总收益'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'GoodsOrder', query: { time: 'day' } })">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="shouyi" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">今日新增算力</div>
            <count-to :start-val="0" :end-val="Number(total['今日新增算力'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="$router.push({ name: 'GoodsOrder', query: { state: '1' } })">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="lir" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">运行总算力</div>
            <count-to :start-val="0" :end-val="Number(total['运行总算力'])" :duration="2000" class="card-panel-num"
              :decimals="2" />
          </div>
        </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import CountTo from 'vue-count-to'
import { GetHomeIndex } from '@/api/users.js'
export default {
  components: {
    CountTo
  },
  data() {
    return {
      total: {}
    }
  },
  mounted() {
    this.gettotal()
  },
  methods: {
    async gettotal() {
      const { success, data } = await GetHomeIndex()
      if (!success) return
      this.total = data;
    },
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    }
  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;

  .chart_title {
    margin-left: 20px;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
    color: #409EFF;
  }

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
    display: flex;
    justify-content: space-between;
    align-items: center;

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }

      .icon-zi {
        background: #7F77FF;
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .icon-zi {
      color: #7F77FF;
    }

    .card-panel-icon-wrapper {
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      font-size: 48px;
    }

    .card-panel-description {
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;
      text-align: right;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width:600px) {
  .card-panel-icon-wrapper {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
